package it.cast.wechat.service.ServiceImpl;

import it.cast.wechat.mapper.OrderItemMapper;
import it.cast.wechat.pojo.OrderItem;
import it.cast.wechat.pojo.OrderItemExample;
import it.cast.wechat.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class OrderItemServiceImpl implements OrderItemService {

    @Autowired
    private OrderItemMapper orderItemMapper;

    @Override
    public List<OrderItem> queryOrderItemByOrderId(String orderId) {
        OrderItemExample example = new OrderItemExample();
        OrderItemExample.Criteria criteria = example.createCriteria();
        criteria.andOrderIdEqualTo(orderId);
        List<OrderItem> orderItems = orderItemMapper.selectByExample(example);

        return orderItems;
    }

    @Override
    public void saveOrderItem(OrderItem orderItem) {
        orderItemMapper.insert(orderItem);
    }

    public OrderItemMapper getOrderItemMapper() {
        return orderItemMapper;
    }

    public void setOrderItemMapper(OrderItemMapper orderItemMapper) {
        this.orderItemMapper = orderItemMapper;
    }
}
